<template>
  <div>
    <div class="bigDiv">
      <div style="border-bottom: solid 0.2rem #f5f5f5">
        <a href="url" onclick="javascript:window.history.go(-1); return false;" style="position: absolute;"><img  src="../../assets/goback.png"  style="float: left;margin-top: 0.1rem;"/></a>
        <p style="text-align: center;font-weight: 600;line-height: 1rem;">推广二维码</p>
      </div>
      <div class="content" style="text-align: center;padding-top: 0.5rem;">
        <img  :src="qrCodeUrl"/>
        <p style="font-size: 0.3rem;">长按识别二维码</p>
      </div>
    </div>
  </div>
</template>

<script>
import QRCode from 'qrcode'
export default {
  name: 'App',
  data() {
    return {
      qrCodeUrl:"",
      qrCodeContent: 'https://orderh5.yt-card.top/entrance?code='+JSON.parse(localStorage.getItem('userInfo')).code,
      // 数据对象
    };
  },
  created(){
    // 计算属性
  },
  mounted() {
    this.generateQRCode()
  },
  methods: {
    // 自定义方法
    generateQRCode() {
      QRCode.toDataURL(this.qrCodeContent, (err, url) => {
        if (err) throw err
        console.log(url)
        this.qrCodeUrl = url
      })
    }
  }
};
</script>

<style scoped>
@import "./index.scss";
/* 组件样式 */
</style>
